var res = [
    {
        "_id": "5fb51a3eac922b6f9405d7be",
        "raw": {
            "text": "demo",
            "title": "demo test",
            "tag": [
                "test"
            ],
            "userId": "tSinwQOXQa",
            "date": "2020-11-18T12:57:34.797Z"
        },
        "replys": [],
        "pid": "9v0xugG245lOMy4U",
        "userId": "tSinwQOXQa",
        "post_status": "created"
    },
    {
        "_id": "5fb51a3eac922b6f9405d1be",
        "raw": {
            "text": "demo dafdsf af sa sad fdsaf saf sa fsad sda sa afdsafasfdsafsadfsadfsdafsafsafsafsa fsa sa as fsa sa",
            "title": "demo test",
            "tag": [
                "test"
            ],
            "userId": "tSinwQOXQa",
            "date": "2020-11-18T12:57:34.797Z"
        },
        "replys": [],
        "pid": "9v0xugG245lOMy4U",
        "userId": "tSinwQOXQa",
        "post_status": "created"
    },
    {
        "_id": "5fb51a3eac922b6f9405d1be",
        "raw": {
            "text": "demo dafdsf af sa sad fdsaf saf sa fsad sda sa fsa sa as fsa sa",
            "title": "demo test",
            "tag": [
                "test"
            ],
            "userId": "tSinwQOXQa",
            "date": "2020-11-18T12:57:34.797Z"
        },
        "replys": [],
        "pid": "9v0xugG245lOMy4U",
        "userId": "tSinwQOXQa",
        "post_status": "created"
    },
]

//small => big
res.sort((a, b) => {
    console.log(a.raw.text.length - b.raw.text.length)
    return a.raw.text.length - b.raw.text.length
})

console.log(res)